package org.bee.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class FileConfig implements WebMvcConfigurer {
    /**
     * 文件保存路径
     */
    @Value("${fileSavePath}")
    private String fileSavePath;
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        /*
          配置资源映射
          请求的url必须包含/admin
         */
        registry.addResourceHandler("/**")
                .addResourceLocations("admin:"+fileSavePath);
    }
}
